using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._General
{
    /// <summary>
    /// <para>Append</para>
    /// <para>Appends multiple input datasets into an existing target dataset. Input datasets can be feature classes, tables, shapefiles, rasters, or annotation or dimensions feature classes.</para>
    /// <para>将多个输入数据集追加到现有目标数据集中。输入数据集可以是要素类、表、shapefile、栅格、注记或尺寸要素类。</para>
    /// </summary>    
    [DisplayName("Append")]
    public class Append : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Append()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_inputs">
        /// <para>Input Datasets</para>
        /// <para><xdoc>
        ///   <para>The input datasets containing the data to be appended to the target dataset. Input datasets can be point, line, or polygon feature classes, tables, rasters, annotation feature classes, or dimensions feature classes.</para>
        ///   <para>Tables and feature classes can be combined. If a feature class is appended to a table, attributes will be transferred, but the features will be dropped. If a table is appended to a feature class, the rows from the input table will have null geometry.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含要追加到目标数据集的数据的输入数据集。输入数据集可以是点、线或面要素类、表、栅格、注记要素类或尺寸标注要素类。</para>
        ///   <para>表和要素类可以组合使用。如果将要素类追加到表中，则将传输属性，但将删除要素。如果将表追加到要素类，则输入表中的行将具有空几何。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_target">
        /// <para>Target Dataset</para>
        /// <para>The existing dataset where the data of the input datasets will be appended.</para>
        /// <para>将在其中追加输入数据集数据的现有数据集。</para>
        /// </param>
        public Append(List<object> _inputs, object _target)
        {
            this._inputs = _inputs;
            this._target = _target;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Append";

        public override string CallName => "management.Append";

        public override List<string> AcceptEnvironments => ["extent", "maintainAttachments", "preserveGlobalIds", "workspace"];

        public override object[] ParameterInfo => [_inputs, _target, _schema_type.GetGPValue(), _field_mapping, _subtype, _output, _expression];

        /// <summary>
        /// <para>Input Datasets</para>
        /// <para><xdoc>
        ///   <para>The input datasets containing the data to be appended to the target dataset. Input datasets can be point, line, or polygon feature classes, tables, rasters, annotation feature classes, or dimensions feature classes.</para>
        ///   <para>Tables and feature classes can be combined. If a feature class is appended to a table, attributes will be transferred, but the features will be dropped. If a table is appended to a feature class, the rows from the input table will have null geometry.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含要追加到目标数据集的数据的输入数据集。输入数据集可以是点、线或面要素类、表、栅格、注记要素类或尺寸标注要素类。</para>
        ///   <para>表和要素类可以组合使用。如果将要素类追加到表中，则将传输属性，但将删除要素。如果将表追加到要素类，则输入表中的行将具有空几何。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Datasets")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _inputs { get; set; }


        /// <summary>
        /// <para>Target Dataset</para>
        /// <para>The existing dataset where the data of the input datasets will be appended.</para>
        /// <para>将在其中追加输入数据集数据的现有数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _target { get; set; }


        /// <summary>
        /// <para>Field Matching Type</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the fields of the input dataset must match the fields of the target dataset for data to be appended.</para>
        ///   <bulletList>
        ///     <bullet_item>Input fields must match target fields—Fields from the input dataset must match the fields of the target dataset. An error will be returned if the fields do not match.</bullet_item><para/>
        ///     <bullet_item>Use the field map to reconcile field differences—Fields from the input dataset do not need to match the fields of the target dataset. Any fields from the input datasets that do not match the fields of the target dataset will not be mapped to the target dataset unless the mapping is explicitly set in the Field Map parameter.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输入数据集的字段是否必须与目标数据集的字段匹配才能追加数据。</para>
        ///   <bulletList>
        ///     <bullet_item>输入字段必须与目标字段匹配 - 输入数据集中的字段必须与目标数据集的字段匹配。如果字段不匹配，将返回错误。</bullet_item><para/>
        ///     <bullet_item>使用字段地图协调字段差异 - 输入数据集中的字段不需要与目标数据集的字段匹配。除非在 Field Map 参数中显式设置映射，否则输入数据集中与目标数据集的字段不匹配的任何字段都不会映射到目标数据集。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Matching Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _schema_type_value _schema_type { get; set; } = _schema_type_value._TEST;

        public enum _schema_type_value
        {
            /// <summary>
            /// <para>Input fields must match target fields</para>
            /// <para>Input fields must match target fields—Fields from the input dataset must match the fields of the target dataset. An error will be returned if the fields do not match.</para>
            /// <para>输入字段必须与目标字段匹配 - 输入数据集中的字段必须与目标数据集的字段匹配。如果字段不匹配，将返回错误。</para>
            /// </summary>
            [Description("Input fields must match target fields")]
            [GPEnumValue("TEST")]
            _TEST,

            /// <summary>
            /// <para>Use the field map to reconcile field differences</para>
            /// <para>Use the field map to reconcile field differences—Fields from the input dataset do not need to match the fields of the target dataset. Any fields from the input datasets that do not match the fields of the target dataset will not be mapped to the target dataset unless the mapping is explicitly set in the Field Map parameter.</para>
            /// <para>使用字段地图协调字段差异 - 输入数据集中的字段不需要与目标数据集的字段匹配。除非在 Field Map 参数中显式设置映射，否则输入数据集中与目标数据集的字段不匹配的任何字段都不会映射到目标数据集。</para>
            /// </summary>
            [Description("Use the field map to reconcile field differences")]
            [GPEnumValue("NO_TEST")]
            _NO_TEST,

        }

        /// <summary>
        /// <para>Field Map</para>
        /// <para><xdoc>
        ///   <para>Controls how the attribute fields from the input datasets will be transferred or mapped to the target dataset.</para>
        ///   <para>This parameter can only be used if the Field Matching Type parameter is set to Use the field map to reconcile field differences.</para>
        ///   <para>Because the input datasets are appended to an existing target dataset that has predefined fields, you cannot add, remove, or change the type of the fields in the field map. You can set merge rules for each output field.</para>
        ///   <para>Merge rules allow you to specify how values from two or more input fields are merged or combined into a single output value. There are several merge rules you can use to determine how the output field will be populated with values.
        ///   <bulletList>
        ///     <bullet_item>First—Use the input fields' first value.  </bullet_item><para/>
        ///     <bullet_item>Last—Use the input fields' last value.  </bullet_item><para/>
        ///     <bullet_item>Join—Concatenate (join) the input field values.  </bullet_item><para/>
        ///     <bullet_item>Sum—Calculate the total of the input field values.  </bullet_item><para/>
        ///     <bullet_item>Mean—Calculate the mean (average) of the input field values.  </bullet_item><para/>
        ///     <bullet_item>Median—Calculate the median (middle) of the input field values.  </bullet_item><para/>
        ///     <bullet_item>Mode—Use the value with the highest frequency.  </bullet_item><para/>
        ///     <bullet_item>Min—Use the minimum value of all the input field values.  </bullet_item><para/>
        ///     <bullet_item>Max—Use the maximum value of all the input field values.  </bullet_item><para/>
        ///     <bullet_item>Standard deviation—Use the standard deviation classification method on all the input field values.  </bullet_item><para/>
        ///     <bullet_item>Count—Find the number of records included in the calculation.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>控制如何将输入数据集中的属性字段传输或映射到目标数据集。</para>
        ///   <para>仅当字段匹配类型参数设置为使用字段映射协调字段差异时，才能使用此参数。</para>
        ///   <para>由于输入数据集将追加到具有预定义字段的现有目标数据集，因此您无法添加、移除或更改字段映射中的字段类型。您可以为每个输出字段设置合并规则。</para>
        /// <para>合并规则允许您指定如何将两个或多个输入字段中的值合并或组合为单个输出值。您可以使用多个合并规则来确定如何使用值填充输出字段。
        ///   <bulletList>
        ///     <bullet_item>第一 - 使用输入字段的第一个值。</bullet_item><para/>
        ///     <bullet_item>最后 （Last） - 使用输入字段的最后一个值。</bullet_item><para/>
        ///     <bullet_item>连接 （Join） - 连接（连接）输入字段值。</bullet_item><para/>
        ///     <bullet_item>求和 （Sum） - 计算输入字段值的总和。</bullet_item><para/>
        ///     <bullet_item>均值 （Mean） - 计算输入字段值的平均值（平均值）。</bullet_item><para/>
        ///     <bullet_item>中位数 - 计算输入字段值的中位数（中间值）。</bullet_item><para/>
        ///     <bullet_item>模式 （Mode） - 使用频率最高的值。</bullet_item><para/>
        ///     <bullet_item>最小值 （Min） - 使用所有输入字段值的最小值。</bullet_item><para/>
        ///     <bullet_item>最大值 （Max） - 使用所有输入字段值的最大值。</bullet_item><para/>
        ///     <bullet_item>标准差 - 对所有输入字段值使用标准差分类方法。</bullet_item><para/>
        ///     <bullet_item>计数 （Count） - 查找计算中包含的记录数。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Map")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _field_mapping { get; set; } = null;


        /// <summary>
        /// <para>Subtype</para>
        /// <para>The subtype description to assign to all new data that is appended to the target dataset.</para>
        /// <para>要分配给追加到目标数据集的所有新数据的子类型描述。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Subtype")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _subtype { get; set; } = null;


        /// <summary>
        /// <para>Updated Target Dataset</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Target Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _output { get; set; }


        /// <summary>
        /// <para>Expression</para>
        /// <para><xdoc>
        ///   <para>The SQL expression used to select a subset of the input datasets' records. If multiple input datasets are specified, they will all be evaluated using the expression. If no records match the expression for an input dataset, no records from that dataset will be appended to the target.</para>
        ///   <para>For more information about SQL syntax, see SQL reference for query expressions used in ArcGIS.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于选择输入数据集记录的子集的 SQL 表达式。如果指定了多个输入数据集，则将使用表达式计算它们。如果没有记录与输入数据集的表达式匹配，则不会将该数据集中的任何记录追加到目标中。</para>
        ///   <para>有关 SQL 语法的详细信息，请参阅 ArcGIS 中使用的查询表达式的 SQL 参考。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Expression")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _expression { get; set; } = null;


        public Append SetEnv(object extent = null, object workspace = null)
        {
            base.SetEnv(extent: extent, workspace: workspace);
            return this;
        }

    }

}